package com.nantai.jiafang.nantaijiafang.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.nantai.jiafang.nantaijiafang.IConstant;
import com.nantai.jiafang.nantaijiafang.R;

public class LoadingActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_loading);
        mHandler.sendEmptyMessageDelayed(0, 1000);
    }

    Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            startActivity(new Intent(LoadingActivity.this,LoginActivity.class));
//            SharedPreferences sharedPreferences= getSharedPreferences(IConstant.FILE_USER,
//                    Activity.MODE_PRIVATE);
//            String name =sharedPreferences.getString(IConstant.SP_USERNAME, "");
//            if (name.equals("")){
//                startActivity(new Intent(LoadingActivity.this,LoginActivity.class));
//            }else{
//                startActivity(new Intent(LoadingActivity.this,MainActivity.class));
//            }
            finish();
        }
    };
}
